package com.iee.io;

import org.apache.commons.io.IOUtils;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;

/**
 * org.apache.commons.io
 */
public class Apache_Commons_IOUtils {
    public static void main(String[] args) throws IOException {
        //  读
        IOUtils.readLines(new FileInputStream("D:\test.txt"), Charset.defaultCharset());
        // 写
        IOUtils.write("aa", new FileOutputStream("D:\test.txt"), Charset.defaultCharset());
        // 拷贝
        IOUtils.copy(new FileInputStream("/temp/a.txt"), new FileOutputStream("/temp/b.txt"));
        // 读取文件到字节数组
        byte[] bytes = IOUtils.toByteArray(new FileInputStream("/temp/a.txt"));

    }
}
